package com.leyou.page.controller;


import com.leyou.page.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: ycs
 * Date: 2020/8/26
 * Time: 20:15
 *
 * @author: ycs
 * Description: No Description
 */
@Controller
public class PageController {
    @Autowired
    private PageService pageService;

    /**
     * 提供商品详情页信息
     * @param model
     * @param spuId
     * @return
     */
    @GetMapping("/item/{spuId}.html")
    public String toGoodsDetailPage(Model model, @PathVariable("spuId") Long spuId){
        Map<String,Object>itemSpu=pageService.toGoodsDetailPage(spuId);
        model.addAllAttributes(itemSpu);
        return "item";
    }
}
